<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>CSS2中的可视化格式模型_Visual fomatting model in CSS2 | 宅鱼</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="google-site-verification" content="yH7MwnMb7LXru16F4FAfY94pn-oZLhF8Szu4PuL7Oxw" />
  <meta name="description" content="css2的可视化格式模型内容太多，我想简单的总结下，方便理解,以下是关键点:  视点 viewport 包含块 Containing blocks 控制包含框的生成 Controlling box generation 定位方案 Positioning schemes 常规流向 Normal flow 浮动 Floats 绝对定位 Absolute positioningw3c 规范原文: Vis">
<meta name="keywords" content="CSS,w3c标准,web,翻译">
<meta property="og:type" content="article">
<meta property="og:title" content="CSS2中的可视化格式模型_Visual fomatting model in CSS2">
<meta property="og:url" content="http://ikkkr.com/2011/02/20/css2-e4-b8-ad-e7-9a-84-e5-8f-af-e8-a7-86-e5-8c-96-e6-a0-bc-e5-bc-8f-e6-a8-a1-e5-9e-8b-visual-fomatting-model-in-css2/index.html">
<meta property="og:site_name" content="宅鱼">
<meta property="og:description" content="css2的可视化格式模型内容太多，我想简单的总结下，方便理解,以下是关键点:  视点 viewport 包含块 Containing blocks 控制包含框的生成 Controlling box generation 定位方案 Positioning schemes 常规流向 Normal flow 浮动 Floats 绝对定位 Absolute positioningw3c 规范原文: Vis">
<meta property="og:locale" content="default">
<meta property="og:image" content="http://www.webdevelopmentmachine.com/images/block_box.jpg">
<meta property="og:image" content="http://www.w3.org/TR/CSS21/images/anon-block.png">
<meta property="og:image" content="http://www.webdevelopmentmachine.com/images/anony_box.jpg">
<meta property="og:image" content="http://www.webdevelopmentmachine.com/images/inline_box.jpg">
<meta property="og:image" content="http://www.webdevelopmentmachine.com/images/flow_element.jpg">
<meta property="og:image" content="http://www.webdevelopmentmachine.com/images/inline_formatting_context.png">
<meta property="og:image" content="http://www.w3.org/TR/CSS21/images/inline-layout.png">
<meta property="og:image" content="http://www.webdevelopmentmachine.com/images/float_1.png">
<meta property="og:image" content="http://www.w3.org/TR/CSS21/images/supercal.png">
<meta property="og:image" content="http://www.w3.org/TR/CSS21/images/floateg.png">
<meta property="og:image" content="http://www.w3.org/TR/CSS21/images/float2p.png">
<meta property="og:image" content="http://www.w3.org/TR/CSS21/images/floatclear.png">
<meta property="og:image" content="http://www.w3.org/TR/CSS21/images/float-right.png">
<meta property="og:image" content="http://www.w3.org/TR/CSS21/images/clearance.png">
<meta property="og:image" content="http://www.w3.org/TR/CSS21/images/frame.png">
<meta property="og:updated_time" content="2018-04-01T12:38:40.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="CSS2中的可视化格式模型_Visual fomatting model in CSS2">
<meta name="twitter:description" content="css2的可视化格式模型内容太多，我想简单的总结下，方便理解,以下是关键点:  视点 viewport 包含块 Containing blocks 控制包含框的生成 Controlling box generation 定位方案 Positioning schemes 常规流向 Normal flow 浮动 Floats 绝对定位 Absolute positioningw3c 规范原文: Vis">
<meta name="twitter:image" content="http://www.webdevelopmentmachine.com/images/block_box.jpg">
  
    <link rel="alternative" href="/atom.xml" title="宅鱼" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.ico"  type="image/x-ico">
   
  <link rel="stylesheet" href="/css/style.css">
  

</head>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">宅鱼</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">部落格</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">首页</a>
        
          <a class="main-nav-link" href="/archives">文章</a>
        
          <a class="main-nav-link" href="/raincss">RainCSS</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://ikkkr.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-css2-e4-b8-ad-e7-9a-84-e5-8f-af-e8-a7-86-e5-8c-96-e6-a0-bc-e5-bc-8f-e6-a8-a1-e5-9e-8b-visual-fomatting-model-in-css2" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2011/02/20/css2-e4-b8-ad-e7-9a-84-e5-8f-af-e8-a7-86-e5-8c-96-e6-a0-bc-e5-bc-8f-e6-a8-a1-e5-9e-8b-visual-fomatting-model-in-css2/" class="article-date">
  <time datetime="2011-02-20T07:12:30.000Z" itemprop="datePublished">2011-02-20</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/CSS-amp-HTML/">CSS &amp; HTML</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      CSS2中的可视化格式模型_Visual fomatting model in CSS2
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>css2的可视化格式模型内容太多，我想简单的总结下，方便理解,以下是关键点:</p>
<ul>
<li>视点 viewport</li>
<li>包含块 Containing blocks</li>
<li>控制包含框的生成 Controlling box generation</li>
<li>定位方案 Positioning schemes</li>
<li>常规流向 Normal flow</li>
<li>浮动 Floats</li>
<li>绝对定位 Absolute positioning<br>w3c 规范原文: <a href="http://www.w3.org/TR/CSS2/visuren.html" target="_blank" rel="noopener">Visual formatting model</a></li>
</ul>
<h3 id="相关词汇"><a href="#相关词汇" class="headerlink" title="相关词汇"></a>相关词汇</h3><p>box model: 盒模型<br>boxes: 盒子,控制框<br>schema: 模式,计划,图解,概要,方案<br>continuous media: 连续媒介<br>paged media: 页面媒介<br>margin properties: 边距属性<br>page model: 页面模型<br>Conforming user agents: 一致性用户端<br>overflow: 溢出<br>block-level boxes: 块级盒,块级框<br>block-level replaced element : 块级可替换元素<br>block formatting context: 块格式化上下文<br>block container box: 块容器盒,块容器框<br>inline formatting context: 行内,内联格式化上下文<br>inline-level boxes: 行内,内联级盒,内联级框<br>block boxs: 块盒,块框<br>inline content: 行内内容,内联内容<br>block content: 块内容<br>anonymous block box: 匿名块控制盒,匿名块控制框<br>in-flow block-level box: 流内块级盒<br>containing inline formatting context: 包含内联格式化上下文<br>atomic inline-level boxes: 原子内联级框<br>out of flow: 外部流<br>in-flow: 内部流<br>line box: 线盒,行盒<br>line break:换行符<br>superscripting: 上标<br>subscripting: 下标<br>border box:边框<br>margin box:边距框<br>stacking context:堆叠上下文<br>clearance: 间隙,清除<br>z-axis: z轴<br>stack level: 堆叠级别</p>
<h3 id="9-1-介绍"><a href="#9-1-介绍" class="headerlink" title="9.1 介绍"></a>9.1 介绍</h3><p>本章和下一章描述了可视化格式模型：用户端在图形<a href="http://www.w3.org/TR/CSS2/media.html" target="_blank" rel="noopener">媒体</a>下如何处理<a href="http://www.w3.org/TR/CSS2/conform.html#doctree" target="_blank" rel="noopener">文档树</a>。</p>
<p>可视化格式模型中，每一个文档树中的元素根据<a href="http://www.w3.org/TR/CSS2/box.html" target="_blank" rel="noopener">盒模型</a>产生零个或多个控制盒。这些盒子的布局由下列内容控制：</p>
<ul>
<li>盒子的<a href="http://www.w3.org/TR/CSS2/box.html#box-dimensions" target="_blank" rel="noopener">尺寸</a>和<a href="http://www.w3.org/TR/CSS2/visuren.html#box-gen" target="_blank" rel="noopener">类型</a>.</li>
<li><a href="http://www.w3.org/TR/CSS2/visuren.html#positioning-scheme" target="_blank" rel="noopener">定位模式</a>(常规流向，浮动和绝对定位).</li>
<li>文档树中元素间的关系.</li>
<li>外部信息(例如，视点大小，图形的固有尺寸等).</li>
</ul>
<p>本章和下一章中定义的属性适用于<a href="http://www.w3.org/TR/CSS2/media.html#continuous-media-group" target="_blank" rel="noopener">连续媒介</a>和<a href="http://www.w3.org/TR/CSS2/media.html#paged-media-group" target="_blank" rel="noopener">页面媒介</a>。不过<a href="http://www.w3.org/TR/CSS2/box.html#margin-properties" target="_blank" rel="noopener">边距属性</a>的含义在应用到页面媒介时会有些不同(详细内容请参见<a href="http://www.w3.org/TR/CSS2/page.html#page-margins" target="_blank" rel="noopener">页面模型</a>).</p>
<p>可视化格式模型并不指定格式化的所有方面(例如，它并不指定字符间距算法)。与CSS一致的用户端在处理本规范未包含的格式化情形时，表现可能有所不同。 对于这个规范没有覆盖到的格式化问题<a href="http://www.w3.org/TR/CSS2/conform.html#conformance" target="_blank" rel="noopener">一致性用户端</a>表现可能不同.</p>
<h4 id="9-1-1-视点-viewport"><a href="#9-1-1-视点-viewport" class="headerlink" title="9.1.1 视点 viewport:"></a>9.1.1 视点 viewport:</h4><p>屏幕上的一个窗口或浏览区域</p>
<p>9.1.2 包含块 Containing blocks:<br>许多的盒子定位和大小是相对与一个矩形盒边缘来计算的，这矩形盒被称为包含块.<br>每个盒子给出一个相对于它的包含块的定位,但是它不被包含块限制,它可能 <a href="http://www.w3.org/TR/CSS2/visufx.html#overflow" target="_blank" rel="noopener">溢出</a>.</p>
<h3 id="9-2-控制框的生成-Controlling-box-generation"><a href="#9-2-控制框的生成-Controlling-box-generation" class="headerlink" title="9.2 控制框的生成 Controlling box generation:"></a>9.2 控制框的生成 Controlling box generation:</h3><h4 id="9-2-1-块级元素和块框-Block-level-elements-and-block-boxes"><a href="#9-2-1-块级元素和块框-Block-level-elements-and-block-boxes" class="headerlink" title="9.2.1 块级元素和块框 Block-level elements and block boxes"></a>9.2.1 块级元素和块框 Block-level elements and block boxes</h4><p>块级盒是参与一个<a href="http://www.w3.org/TR/CSS2/visuren.html#block-formatting" target="_blank" rel="noopener">块格式化上下文</a> 的盒子.每个块级元素生成一个主要的块级盒子,其包含子盒子和生成的内容,同时盒子也涉及到定位的方案.<br>除了table盒，和可替换元素,一个块级盒同时也是一个块容器盒,一个块容器盒只包含块级盒子或是建立一个行内格式化上下文来包含行内级盒.不是所有的 块容器盒都是块级盒,不可替换行内块和不可替换table cells是块容器但不是块级盒.是块级盒子的块容器称作块盒.<br>三个术语 “block-level box,” “block container box,” 和”block box”在意义明确的时候简称为”block”.</p>
<p><img src="http://www.webdevelopmentmachine.com/images/block_box.jpg" alt=""></p>
<p><strong>9.2.1.1 匿名块框 Anonymous block boxes</strong></p>
<p>有这样一个文档：<br>&lt;DIV&gt;<br>Some text<br>&lt;P&gt;More text<br>&lt;/DIV&gt;<br>(并假定DIV和P都设置了’display: block’),DIV包含行内内容和块内容。为了使格式化简单一些，我们假定有一个匿名块控制盒围绕在”Some text”周围。</p>
<p><img src="http://www.w3.org/TR/CSS21/images/anon-block.png" alt="anonymous box"></p>
<p>换句话说:如果一个块容器盒(如上例中为DIV生成的框)有一个块级盒(如上例中的P),那么我们强制它只包含块级盒在其中.</p>
<p>当一个行内盒包含一个流内块级盒,这个行内盒打断周围的块级盒,把行内盒分离成两个盒子,它在块级盒子两边.行盒在打断之前和打断之后都附入匿名块盒,并且该块级盒形成一个同辈匿名盒.当这样的行内盒受到相对定位影响,任何产生的移动同样影响到包含在行内盒内的块级盒.<br>该模型讲应用在下面的例子中,如果规则如下:<br>p    { display: inline }<br>span { display: block }<br>被应用到如下规则:<br>&lt;!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”&gt;<br>&lt;HEAD&gt;<br>&lt;TITLE&gt;Anonymous text interrupted by a block&lt;/TITLE&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>&lt;P&gt;<br>This is anonymous text before the SPAN.<br>&lt;SPAN&gt;This is the content of SPAN.&lt;/SPAN&gt;<br>This is anonymous text after the SPAN.<br>&lt;/P&gt;<br>&lt;/BODY&gt;</p>
<p>p元素包含一块(c1)匿名文本随后是一个块级元素再随后是另一块(c2)匿名文本.产生的盒子为一个块盒代表BODY.包含在c1周围一个匿名块盒,SPAN块盒,和在c2周围的另一个匿名块盒.</p>
<p>匿名盒子的属性继承自围合的非匿名盒子.非继承属性有它们的初始值.例如,匿名盒的font属性继承自div,但是margins是0.<br>设置在导致匿名块盒生成的元素上的属性同样能应用给这些匿名盒子和元素的内容.例如,在上面例子中,如果一个border被设置在P元素上,这个border将围在C1和C2周围.</p>
<p>一些用户代理已经用其它方式实现了borders在行内包含块.例如,把内嵌的块放入”匿名盒中”并在这样的盒子周围绘出行内borders.</p>
<p>当处理百分比值时匿名的块盒子被忽略,它适用于:最近的非匿名祖先盒子被用来替代.例如,如果一个匿名块盒的孩子在DIV里面需要知道包含块的高度来解决一个百分比高度.那么它将使用DIV形成的包含块的高度,而不是匿名块盒的高度.</p>
<p><img src="http://www.webdevelopmentmachine.com/images/anony_box.jpg" alt=""></p>
<p><strong>9.2.2 行内级别元素和行内盒 Inline-level elements and inline boxes</strong></p>
<p>行内级别元素是那些源文档中不形成新的块的内容的元素;内容在行内分布(如,段落内着重的文本，行内图形等等).以下的’display’属性值产 生一个行内级别元素:’inline’, ‘inline-table’, and ‘inline-block’.行内级别元素生成行内级别盒,这些盒子参与行内格式化上下文.</p>
<p>一个行内盒是由行内级别和它的内容一起参与它的包含行内格式化上下文.一个non-replaced元素’display’值是’inline’生 成一个行内盒.那些不是行内盒的行内级别盒(例如replaced inline-level 元素, inline-block 元素, 和 inline-table 元素)被称为原子行内级盒,因为它们作为单一不透明(?)盒参与它们的行内格式化上下文.</p>
<p><img src="http://www.webdevelopmentmachine.com/images/inline_box.jpg" alt=""></p>
<p><strong>9.2.2.1 匿名行内盒 Anonymous inline boxes</strong></p>
<p>任何文本它直接被包含在一个块容器元素必须视为匿名行内元素.</p>
<p>在如下的文档中:</p>
<p>&lt;P&gt;Some &lt;EM&gt;emphasized&lt;/em&gt; text&lt;/P&gt;</p>
<p>P元素生成一个块盒，其内还有几个行内盒.”emphasized”的盒子是一个行内元素(EM)产生的行内盒,而其它的盒子(“Some”和”text”)是块类元素(P)产生的。后者就称为匿名行内盒，因为它们没有与之相关的行内级别元素.</p>
<p>这样的行内盒从其父块盒那里继承可以继承的属性。非继承属性取它们的初始值。例子中，初始匿名盒的颜色继承自P，而背景是透明的。<br>空格内容将根据’white-space’属性而折叠,其不会生成任何匿名行内盒.<br>如果根据上下文可以确定匿名盒是哪种类型，匿名行内控制盒和匿名块控制盒在本规范中都被称为匿名控制盒(匿名盒)。<br>在格式化表格时，还会出现更多类型的匿名盒。</p>
<p>9.2.3 插入盒 Run-in boxes(略)</p>
<p>9.2.4 display属性 The ‘display’ property(略)</p>
<h3 id="9-3-定位方案Positioning-schemes"><a href="#9-3-定位方案Positioning-schemes" class="headerlink" title="9.3 定位方案Positioning schemes"></a>9.3 定位方案Positioning schemes</h3><p>1. 常规流向。CSS2中，常规流向包括块级盒的块格式化，行内级盒的行内格式化，块级盒或行内级盒的相对定位.<br>2. 浮动。在浮动模型中，一个盒子首先根据常规流向布局，再将它从流中取出并尽可能地向左或向右偏移。内容可以排列在一个浮动的边上.<br>3. 绝对定位。在绝对定位模型中，一个盒子整个地从常规流向中脱离（它对后续的同胞没有影响），并根据一个包含块来分配其定位.<br>如果元素是浮动,绝对定位或者是根元素被称作外部流.一个元素不是外部流就是内部流.元素A的流是A的组成元素和所有外部流(out-of-flow)祖先是A的流内(in-flow)元素.</p>
<p><img src="http://www.webdevelopmentmachine.com/images/flow_element.jpg" alt=""></p>
<p>9.3.1 Choosing a positioning scheme: ‘position’ property(略)</p>
<p>9.3.2 Box offsets: ‘top’, ‘right’, ‘bottom’, ‘left’(略)</p>
<h3 id="9-4-常规流Normal-flow"><a href="#9-4-常规流Normal-flow" class="headerlink" title="9.4 常规流Normal flow"></a>9.4 常规流Normal flow</h3><p>盒子在常规流中属于一个格式化上下文,其可能是块或者行内,但不会两者都是.块级盒参与块格式化上下文.行内级盒参与行内格式化上下文.</p>
<h4 id="9-4-1-块格式化上下文-Block-formatting-contexts"><a href="#9-4-1-块格式化上下文-Block-formatting-contexts" class="headerlink" title="9.4.1 块格式化上下文 Block formatting contexts"></a>9.4.1 块格式化上下文 Block formatting contexts</h4><p>浮动,绝对定位元素,一些块容器(比如inline-blocks,table-cells,和table-captions)不是块盒,块盒’overflow’不同于’visible’其为它们的内容建立新的块格式化上下文.<br>在块格式化上下文中,每个盒子左外边界接触包含块的左边界.即使在有浮动的情景下也是如此,除非盒子建立一个新的块格式化上下文(在有些情况下盒子可能由于float而变窄).</p>
<h4 id="9-4-2-行内格式化上下文-Inline-formatting-contexts"><a href="#9-4-2-行内格式化上下文-Inline-formatting-contexts" class="headerlink" title="9.4.2 行内格式化上下文 Inline formatting contexts"></a>9.4.2 行内格式化上下文 Inline formatting contexts</h4><p>在一个行内格式化上下文,盒子水平地排列,一个接着一个,从包含块的顶端开始.水平margins,borders,和padding在这些盒子之 间被考虑.这些盒子可能以不同形式垂直对齐:它们的底部或顶部可能是对齐的,或者文本的基线是对齐的.该矩形区域包含的盒子形成一条线被称作行盒.</p>
<p>行盒的宽度由<a href="http://www.w3.org/TR/CSS21/visuren.html#containing-block" target="_blank" rel="noopener">包含块</a>和存在的浮动决定.<br>通常,行盒的左边接触包含块的左边,右边接触包含块的右边.然而,浮动盒子可能在包含块边缘和行盒边缘中间.因此,尽管行盒在同样的行内上下文有一样的宽度,由于浮动的导致可用水平空间的减少它们的宽度可能会变化.行盒在同样的行内格式化上下文高度是变化的.</p>
<p>当在一行上的行内级盒的总宽度少于包含它们的行盒的宽度,它们在行盒内的水平分布由’text-align’决定.如果这个属性值为’justify’,客户端也可以在行内盒(但不是inline-table和inline-block盒)中伸展空间和文字.</p>
<p>当一个行内盒的宽度超过行盒的宽度,它被分成几个盒,且这些盒子分布在几个行盒.如果一个行内盒不能被分离(如单个字符,或语言规范的文字其打断规则不允许在行内盒打断的,或者该行内盒受白色空格或不能换行值的影响),那么该行内盒溢出该行盒子.</p>
<p>当一个行内盒被分割,margins,borders,和padding在分割出现的地方没有视觉效果.</p>
<p>行内盒可以在同样行盒被分割为几个盒子取决于<a href="http://www.w3.org/TR/CSS21/visuren.html#direction" target="_blank" rel="noopener">双向文本处理</a>.</p>
<p>行盒按需被创建来在行内格式化上下文持有行内级别内容.行盒不包含文本,<a href="http://www.w3.org/TR/CSS21/text.html#white-space-prop" target="_blank" rel="noopener">保留的空格</a>.margins,padding，或者borders非零的行内元素,和其它<a href="http://www.w3.org/TR/CSS21/visuren.html#positioning-scheme" target="_blank" rel="noopener">流内</a>(in-flow)内容(比如images,inline blocks或inline tables),且其不以保留的换行符结尾.为了决定在其中任意元素的定位像这样的行盒必须以0-height 行盒对待,并且为了其它的一些目的必须以不存在对待.</p>
<p><img src="http://www.webdevelopmentmachine.com/images/inline_formatting_context.png" alt=""></p>
<p>这里有个行内盒的实例,下面的段落(由块级元素P创建)包含由元素EM和STRONG间隔的匿名文本:<br>&lt;P&gt;Several &lt;EM&gt;emphasized words&lt;/EM&gt; appear&lt;STRONG&gt;in this&lt;/STRONG&gt; sentence, dear.&lt;/P&gt;<br>P元素生成一个块盒它包含5个行内盒.其中有三个是匿名的:<br>下面是一个行内盒构造的例子。接下来的一段（HTML块类元素P产生）包含由元素EM和STRONG间隔的匿名文本：</p>
<p>&lt;P&gt;Several&lt;EM&gt;emphasized words&lt;/EM&gt;appear&lt;STRONG&gt;in this&lt;/STRONG&gt; sentence, dear.&lt;/P&gt;</p>
<p>P元素产生一个块盒，包含了五个行内盒，其中的三个是匿名的：</p>
<ul>
<li>匿名：”Several”</li>
<li>EM: “emphasized words”</li>
<li>匿名：”appear”</li>
<li>STRONG: “in this”</li>
<li>匿名：”sentence, dear.”<br>为了格式化这一段，用户端将这五个盒排入行。本例中，为P元素生成的盒生成了行内盒的包含块。如果包含块足够宽，所有的行内盒将放在一个行盒内：</li>
</ul>
<p>Several emphasized words appear in this sentence, dear.</p>
<p>如果不是，行内盒将被分割并分布在几个行盒之内。前面这一段可能被分割如下：</p>
<p>Several emphasized words appear<br>in this sentence, dear.</p>
<p>或者这样：<br>Several emphasized<br>words appear in this<br>sentence, dear.</p>
<p>上例中，EM盒被分割为两个EM盒（称为”split1”和”split2”）。边距、边框、边白或文本修饰在split1之后或split2之前没有视觉上的效果.</p>
<p>考虑下面这个例子:</p>
<p>&lt;!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0//EN”&gt;<br>&lt;HTML&gt;<br>&lt;HEAD&gt;<br>&lt;TITLE&gt;Example of inline flow on several lines&lt;/TITLE&gt;<br>&lt;STYLE type=”text/css”&gt;<br>EM {<br>padding: 2px;<br>margin: 1em;<br>border-width: medium;<br>border-style: dashed;<br>line-height: 2.4em;<br>}<br>&lt;/STYLE&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>&lt;P&gt;Several &lt;EM&gt;emphasized words&lt;/EM&gt; appear here.&lt;/P&gt;<br>&lt;/BODY&gt;<br>&lt;/HTML&gt;</p>
<p>根据P的宽度，这些盒可能分配如下:</p>
<p><img src="http://www.w3.org/TR/CSS21/images/inline-layout.png" alt="Image illustrating the effect of line breaking on the display of margins, borders, and padding."></p>
<ul>
<li>在”emphasized”之前和”words”之后插入了margin.</li>
<li>在”emphasized”之前、之上和之下，”words”之后、之上和之下插入了padding。在每个单词的三边渲染了虚线边框.</li>
</ul>
<h4 id="9-4-3-相对定位-Relative-positioning"><a href="#9-4-3-相对定位-Relative-positioning" class="headerlink" title="9.4.3 相对定位 Relative positioning"></a>9.4.3 相对定位 Relative positioning</h4><p>一旦一个盒子按照<a href="http://www.w3.org/TR/CSS21/visuren.html#normal-flow" target="_blank" rel="noopener">普通流</a>或 浮动布局,它可能相对原来的位置有偏移,这被称作相对定位.以这种方式偏移一个盒子(B1)对跟随其后的盒子(B2)没有 影响.B2的定位好像B1没有偏移,并且在B1应用了偏移后B2不进行重新定位.这意味着相对定位会导致盒子重叠.然而,如果相对定位导致 ‘overflow:auto’ 或 ‘overflow:scroll’盒子溢出,客户端必须允许用户访问这些内容(在它的偏移位置),穿过创建的scrollbar可能会影响布局.</p>
<p>一个相对定位盒子保持它普通流的尺寸,包含换行符和最初的空白为其而保留.这个章节在<a href="http://www.w3.org/TR/CSS21/visuren.html#containing-block" target="_blank" rel="noopener">包含块</a>介绍什么时候一个相对定位的盒子建立一个新的包含块.</p>
<p>对相对定位元素,在没有改变它们尺寸情况下,’left’和’right’水平地移动盒子.’Left’向右边移动盒子,并且’right’向左边移动盒子.因为盒子不会由于’left’或’right’分离或是伸展,使用的值总是left=-right.</p>
<p>如果’left’和’right’值都是’auto’(它们的初始值),使用的值是’0’(也就是盒子在它们的初始位置).</p>
<p>如果’left’值是’auto’,它使用的值是减去’right’后的值(也就是盒子通过’right’值向左移动).</p>
<p>如果’right’值被指定为’auto’,它使用的值是减去’left’后的值.</p>
<p>如果’left’或’right’值都不是’auto’,定位则over-constrained,且其中的一个值会被忽略.如果包含块的 ‘direction’属性值为’ltr’,’left’值胜出且’right’值变为-‘left’(减去left值).如果包含块的 ‘direction’值是’rtl’,’right’胜出’left’值被忽略.</p>
<p>例子.下面的三个规则等价于:<br>div.a8 { position: relative; direction: ltr; left: -1em; right: auto }<br>div.a8 { position: relative; direction: ltr; left: auto; right: 1em }<br>div.a8 { position: relative; direction: ltr; left: -1em; right: 5em }</p>
<p>在不改变尺寸的情况下’top’和’bottom’属性值上下移动相对定位元素.’Top’把盒子向上移动,’bottom’把它们向下移动.因为盒子不 会由于’top’或’bottom’值分割或是伸展,经常使用的值是:top=-bottom.如果它们都是’auto’,它们使用的值都为’0’.如果 它们中的一个是’auto’,它成为另一个的负值.如果两者都不是’auto’,’bottom’被忽略(也就是,使用的bottom值讲减去’top’ 值).</p>
<p>注意:相对定位盒子在脚本环境动态移动能产生动画效果(见’visibility’属性).尽管相对定位可能被用作上标和下标的形式,行高不会自动地将适应定位考虑进去.见<a href="http://www.w3.org/TR/CSS21/visudet.html#line-height" target="_blank" rel="noopener">行高计算</a>描述的更多信息.</p>
<p>相对定位的例子在<a href="http://www.w3.org/TR/CSS21/visuren.html#comparison" target="_blank" rel="noopener">comparing normal flow, floats, and absolute positioning</a>章节提供.</p>
<h3 id="9-5-浮动-Floats"><a href="#9-5-浮动-Floats" class="headerlink" title="9.5 浮动 Floats"></a>9.5 浮动 Floats</h3><p>浮动是一个盒子在当前行向左或右偏移.一个float(或者”floated”或者”floating”盒子)最有趣的特征是内容可以沿着它的边 (或通过’clear’属性禁止).内容由于左浮动的盒子流向右下边,由于右浮动的盒子流向左下方.接下来是一个对float定位和内容流的介 绍;float行为的准确<a href="http://www.w3.org/TR/CSS21/visuren.html#float-rules" target="_blank" rel="noopener">规则</a>在’float’属性有描述.</p>
<p>一个浮动盒子向左或是右进行偏移直到外边缘接触到包含块边缘或者另一个浮动的外边缘.如果有一个行盒,浮动盒的顶部外面和当前行盒的顶部对齐.</p>
<p>如果浮动没有足够的水平空间,它向下偏移直到它适应或者没有更多浮动出现.(no more floats present.)</p>
<p>因为浮动不在流(flow)中,非定位块盒在浮动盒前面和后面被创建,垂直地.好像浮动不存在一样.但是,当前和后面的行盒紧挨着浮动被创建,它们会按需要缩短来为浮动盒的margin让出空间.</p>
<p>一个行盒会紧接挨一个浮动,条件是存在一个垂直的定位其满足四个条件:(a)在行盒的顶部或顶部下面.(b)在行盒的底部或底部上面.(c)在浮动顶部的margin边缘下面(d)在浮动的底部margin边缘上面.</p>
<p>注意:这意味着外部高度为0或为负数的浮动不会缩短行盒.</p>
<p>如果一个缩短的行盒对内容来说太小,那么 这个行盒向下移动(它的宽度重新计算),直到内容适应,或是没有更多浮动出现.任何内容(在当前行)在一个 浮动的盒子之前流入浮动另一边的同样的行,换句话说,如果行内级别盒被强加到在左浮动前的行刚好碰到其适合在剩下的行盒空间,左浮动被强加到那行,和行盒 的顶部对齐,然后在行上的行内级别盒相应地被移动到浮动的右边(右边成为左浮动的另一边)反过来对rtl和右浮动也一样.</p>
<p><img src="http://www.webdevelopmentmachine.com/images/float_1.png" alt=""></p>
<p>table的border框,块级可替换元素,或者一个普通流内的元素其建立一个新的<a href="http://www.w3.org/TR/CSS21/visuren.html#block-formatting" target="_blank" rel="noopener">块格式化上下文</a>(例 如,一个’overflow’元素不同于 ‘visible’元素)必须不重叠任何浮动的盒子的margin框,在同样的块格式化上下文就像元素本身一样.如果需要,实现应该通过放置它在之前浮动 元素的下面来清除上述的元素,但如果有足够的空间可能放置它到临近的浮动.他们可能甚至使得上述的border框比<a href="http://www.w3.org/TR/CSS21/visudet.html#blockwidth" target="_blank" rel="noopener">section 10.3.3</a> 定义的更窄.CSS2不定义什么时候客户端可以放置上述的元素紧挨着浮动或者上述的元素可以变窄多少.</p>
<p><strong>例如.</strong>在下面的文档片段,包含块对包含紧接着浮动的内容太窄.于是内容被移动到浮动的下面,其在行盒内的对齐方式由text-align属性决定.<br>p { width: 10em; border: solid aqua; }<br>span { float: left; width: 5em; height: 5em; border: solid blue; }</p>
<p>…</p>
<p>&lt;p&gt;<br>&lt;span&gt; &lt;/span&gt;<br>Supercalifragilisticexpialidocious<br>&lt;/p&gt;</p>
<p>这片段可能看起来像:</p>
<p><img src="http://www.w3.org/TR/CSS21/images/supercal.png" alt="Image illustrating the effect of an unbreakable piece of content being reflowed to just after a float which left insufficient room next to it for the content to fit."></p>
<p>几个浮动可能是相邻的,这个模型同样适用于同行相邻的浮动.</p>
<p>接下来的规则用 浮动所有的IMG盒到左边(设置左边的margin为’0’):</p>
<p>img.icon {<br>float: left;<br>margin-left: 0;<br>}</p>
<p>考虑下面的HTML源码和样式:</p>
<p>&lt;!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”&gt;<br>&lt;HTML&gt;<br>&lt;HEAD&gt;<br>&lt;TITLE&gt;Float example&lt;/TITLE&gt;<br>&lt;STYLE type=”text/css”&gt;<br>IMG { float: left }<br>BODY, P, IMG { margin: 2em }<br>&lt;/STYLE&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>&lt;P&gt;&lt;IMG src=img.png alt=”This image will illustrate floats”&gt;<br>Some sample text that has no other…<br>&lt;/BODY&gt;<br>&lt;/HTML&gt;</p>
<p>IMG盒被浮动到左边.紧接着的内容被格式化到浮动的右边,开始于同样一行如同浮动一样.在浮动右边的行盒根据存在的浮动被缩短.但在浮动之后恢复它们的”normal”宽度(它的包含块由P元素创建).该文档可能被格式化成:</p>
<p><img src="http://www.w3.org/TR/CSS21/images/floateg.png" alt="Image illustrating how floating boxes interact with margins."> <a href="http://www.w3.org/TR/CSS21/images/longdesc/floateg-desc.html" title="Long description of float and text flow example" target="_blank" rel="noopener">[D]</a></p>
<p>如果文档如下格式将完全相同:<br>&lt;BODY&gt;<br>&lt;P&gt;Some sample text<br>&lt;IMG src=img.png alt=”This image will illustrate floats”&gt;<br>that has no other…<br>&lt;/BODY&gt;<br>因为浮动左边的内容被浮动替换重新流下它的右边.</p>
<p>如<a href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" target="_blank" rel="noopener">章节8.3.1</a> 所说,浮动盒的margin绝不会和临近的盒<a href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" target="_blank" rel="noopener">重叠</a>.因此,在前面的例子中,在P盒和浮动的IMG盒之间垂直的margin不会重叠.</p>
<p>浮动的内容是堆叠的就好像浮动生成了新的堆叠上下文(stacking contexts),除了一些positioned元素和一些创建了新的堆叠上下文的元素并且其参加浮动的父级堆上下文. 一个浮动能够重叠普通流中的其它盒子(例如,当普通流盒子紧接着浮动有负的margin).当它发生后,浮动在no-positioned流内块的前面重 渲染,但在流内行内(inlines)后面.</p>
<p>这里有另一个演示,演示了在普通流中当一个浮动重叠元素的borders会发生什么.</p>
<p><img src="http://www.w3.org/TR/CSS21/images/float2p.png" alt="Image showing a floating image that overlaps the borders of two paragraphs: the borders are interrupted by the image."> <a href="http://www.w3.org/TR/CSS21/images/longdesc/float2p-desc.html" title="Long description of how floats overlap with boxes in normal flow" target="_blank" rel="noopener">[D]</a></p>
<p><strong>A floating image obscures borders of block boxes it overlaps.</strong></p>
<p>下一个例子演示了使用’clear’属性去阻止内容紧挨着一个浮动.</p>
<p>假设一个规则例如:<br>p { clear: left }<br>格式应该看起来像:</p>
<p><img src="http://www.w3.org/TR/CSS21/images/floatclear.png" alt="Image showing a floating image and the effect of "> <a href="http://www.w3.org/TR/CSS21/images/longdesc/floatclear-desc.html" title="Long description of how floats overlap with boxes in normal flow" target="_blank" rel="noopener">[D]</a></p>
<p><strong>Both paragraphs have set ‘clear: left’, which causes the second paragraph to be “pushed down” to a position below the float — “clearance” is added above its top margin to accomplish this (see the **</strong><a href="http://www.w3.org/TR/CSS21/visuren.html#propdef-clear" target="_blank" rel="noopener">‘clear’</a> property). **</p>
<h3 id="9-5-1-浮动的定位：’float’属性-Positioning-the-float-the-‘float’-property"><a href="#9-5-1-浮动的定位：’float’属性-Positioning-the-float-the-‘float’-property" class="headerlink" title="9.5.1 浮动的定位：’float’属性 Positioning the float: the ‘float’ property"></a>9.5.1 浮动的定位：’float’属性 Positioning the float: the ‘float’ property</h3><p><strong>‘float’ </strong><br>值：   left | right | none | inherit<br>初始值：   none<br>适用于：   除了定位的元素和生成的内容之外的所有元素<br>可否继承：   否<br>百分比：   N/A<br>媒介：   图形</p>
<p>该属性指定一个盒是否应该向左，向右浮动或不浮动。它适用于产生盒子但不是<a href="http://www.w3.org/TR/CSS21/visuren.html#absolutely-positioned" target="_blank" rel="noopener">绝对定位</a>的所有元素。该属性取值的含义如下：</p>
<p><strong>left </strong><br>该元素产生一个<a href="http://www.w3.org/TR/CSS21/visuren.html#block-boxes" target="_blank" rel="noopener">块</a>盒，并向左浮动。内容在该盒的右边排列，开始于顶部(受限于’clear’属性).<br><strong>right </strong><br>和’left’相同，除了盒子向右浮动,内容排列在盒的左边，开始于顶部.<br><strong>none</strong><br>该盒不浮动.</p>
<p>下面是一些更精确的规则来控制浮动的表现:</p>
<ol>
<li>向左浮动的盒的左<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">外边</a>不可以出现在它的<a href="http://www.w3.org/TR/CSS21/visuren.html#containing-block" target="_blank" rel="noopener">包含块</a>左边界之左。对于向右浮动的元素也有类似的规则.</li>
<li>如果当前的盒向左浮动，并且在源文档中先前有元素产生了任何向左浮动的盒，那么对于每一个这样的先前的盒，要么当前盒的左<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">外边</a>出现先前盒的右<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">外边</a>之右，要么它的顶部必须在先前的盒的底部之下。对于向右浮动的盒也有类似的规则.</li>
<li>向左浮动的盒的右<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">外边</a>不可以出现在它右边的任何向右浮动的盒子的左<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">外边</a>之右.对于向右浮动的元素也有类似的规则.</li>
<li>一个浮动盒的<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">外顶边</a>不可以高于它的<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">包含块</a>的顶.当浮动在两个折叠的margin间发生,浮动定位就好像有另外一个空的<a href="http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level" target="_blank" rel="noopener">父级匿名块</a>参与流.这样的父级定位在margin collapsing章节定义了<a href="http://www.w3.org/TR/CSS21/box.html#collapsed-through" target="_blank" rel="noopener">规则</a>.</li>
<li>浮动盒的<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">顶边</a>不可以高于源文档中先前的元素产生的<a href="http://www.w3.org/TR/CSS21/visuren.html#block-boxes" target="_blank" rel="noopener">块</a>或<a href="http://www.w3.org/TR/CSS21/visuren.html#floats" target="_blank" rel="noopener">浮动</a>盒的顶.</li>
<li>一个元素的<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">顶边</a>不可以高于源文档中先前的元素产生的包含一个盒的任何<a href="http://www.w3.org/TR/CSS21/visuren.html#line-box" target="_blank" rel="noopener">行盒</a>的顶.</li>
<li>向左浮动的盒如果在它左边有另外一个向左浮动的盒，它的右外边不可以出现在它的包含块的右边之右.(或者比较宽松的要求是:一个左浮动不可以超出右边,除非它已经尽可能地靠左排列.)对于向右浮动的元素也有类似的规则.</li>
<li>一个浮动盒要放置得尽可能的高.</li>
<li>一个左浮动盒必须尽量靠左放置，一个右浮动盒必须尽量靠右放置。在更高的位置和更靠左或靠右的位置间，选择前者.<br>但是在CSS2.1,如果,在块格式化上下文,有一个流内负的垂直margin,这样这个浮动的position在这个原本的位置之上,所有的这些负margin设置为0,浮动的position是undefined.</li>
</ol>
<p>参照这些规则中其它的元素仅指像浮动一样在同样<a href="http://www.w3.org/TR/CSS21/visuren.html#block-formatting" target="_blank" rel="noopener">块格式化上下文</a>的其它元素.</p>
<p>这个HTML片段结果是b浮动到右边.<br>&lt;P&gt;a&lt;SPAN style=”float: right”&gt;b&lt;/SPAN&gt;&lt;/P&gt;<br>如果P元素宽度足够,a和b将会并排,它应该看起来像:</p>
<p><img src="http://www.w3.org/TR/CSS21/images/float-right.png" alt="An a at the left side of a box and a b at the right side"></p>
<h4 id="9-5-2-控制紧接浮动的排列-’clear’属性"><a href="#9-5-2-控制紧接浮动的排列-’clear’属性" class="headerlink" title="9.5.2 控制紧接浮动的排列:’clear’属性"></a>9.5.2 控制紧接浮动的排列:’clear’属性</h4><p><strong>‘clear’ </strong><br>值：   none | left | right | both | inherit<br>初始值：   none<br>适用于：   块级元素<br>可否继承：   否<br>百分比：   N/A<br>媒介：   图形</p>
<p>该属性表明一个元素的盒的哪一边不可以和一个先前的浮动盒相邻.’clear’属性不考虑在元素自身或者在其它<a href="http://www.w3.org/TR/CSS21/visuren.html#block-formatting" target="_blank" rel="noopener">块格式化上下文</a>里面的浮动</p>
<p>当应用于非浮动的块盒时，取值的含义如下：</p>
<p><strong>left </strong><br>要求盒的顶部border的边缘低于早在源文档中形成的任何左浮动盒子的的底部外缘.<br><strong>right </strong><br>要求盒的顶部border的边缘低于早在源文档中形成的任何右浮动盒子的的底部外缘.<br><strong>both </strong><br>要求盒的顶部border的边缘低于早在源文档中形成的任何左浮动盒子和右浮动盒子的的底部外缘.<br><strong>none </strong><br>对考虑到浮动后的盒的位置没有约束.</p>
<p>值除了’none’潜在地引入间隙,间隙阻止margin重叠并充当一个元素的margin-top上面的间隔,它用来推动元素垂直地越过浮动。</p>
<p>计算设置clear元素的间隙是通过先确定假设元素的顶部边框的边缘的位置.这个位置是当元素的’clear’属性值为’none’时顶部border边缘所在的位置.</p>
<p>如果元素顶部border边缘假定的位置没有越过相关的浮动,那么间隙引入进来,margin的重叠由 8.3.1的规则决定.</p>
<p>间隙的总数设置为较大者:<br>1.总数必须放置块的border边缘和最下面被清除的浮动bottom外边缘.<br>2.在水平位置总数必须放置顶块的border边.<br>作为一中选择,间隙确切的设置必须的数量来放置块的border边甚至和被清除的最底的浮动的底部外边缘.<br><em><strong> 注意</strong>:两个行为都允许对存在网页内容的兼容性进行不定求值(pending evaluation).未来的CSS规范将要求其中一个或者其它.</em><br>注意:间隙可以是负数或0.</p>
<p>例 1.假定(为了简单),我们只有3个盒子,在这个规则中:块B1和有bottom margin M1(B1没有子内容没有padding或者border),浮动块F有height H,且块B2带有top margin M2(没有padding或者border,没有子内容).B2的’clear’设置为’both’.我们同样假设B2不为空.</p>
<p>不考虑B2的’clear’属性,我们有下面图表的情形.B1和B2的margin重叠.我们说B1的底border边在y=0的位置.然后,F的顶部在y=M1的位置,B2的顶border边在y=max(M1,M2),F的底部在 y = M1 + H.</p>
<p><img src="http://www.w3.org/TR/CSS21/images/clearance.png" alt="Float F extends into the margin above M2."></p>
<p>我们同样假设B2不在F下面,也就是,我们在规范描述的情形中,我们需要添加清除.那意味着:</p>
<p>max(M1,M2) &lt; M1 + H</p>
<p>我们需要计算清除C两次,C1和C2,并保留两者中的最大值:C=max(C1,C2).第一种方式是让B2的顶部和F的底部齐平,也就是在 y = M1 + H.那意思是,因为使用了清除它们之间的margin不再重叠:</p>
<p>bottom of F = top border edge of B2 ⇔</p>
<p>M1 + H = M1 + C1 + M2</p>
<p>C1 = M1 + H - M1 - M2</p>
<p>= H - M2</p>
<p>第二种计算方式是保持B2的顶部不变,也就是在 y= max(M1,M2). 那意思是:</p>
<p>max(M1,M2) = M1 + C2 + M2 ⇔</p>
<p>C2 = max(M1,M2) - M1 - M2</p>
<p>我们假设max(M1,M2) &lt; M1 + H,其意味着:</p>
<p>C2 = max(M1,M2) - M1 - M2 &lt; M1 + H - M1 - M2 = H - M2 ⇒</p>
<p>C2 &lt; H - M2<br>且,由于C1 = H - M2,于是:</p>
<p>C2 &lt; C1</p>
<p>因此</p>
<p>C = max(C1,C2) = C1</p>
<p>例2.一个清除为负数情形下的例子,在这里清除是-1em.(假设没有元素有border和padding):</p>
<p>&lt;p style=”margin-bottom: 4em”&gt;<br>First paragraph.</p>
<p>&lt;p style=”float: left; height: 2em; margin: 0”&gt;<br>Floating paragraph.</p>
<p>&lt;p style=”clear: left; margin-top: 3em”&gt;<br>Last paragraph.</p>
<p>说明:没有’clear’,首个和末尾段落的margin将重叠,并且最后的段落的顶部border边将和浮动段落的顶部对齐.但是’clear’要求顶 border边在浮动下面.也就是降低2em.这个意思是空隙必须引入.相应地,margin不再重叠且空隙的总数设置结果是clearance + margin-top = 2em,也就是clearance = 2em - margin-top = 2em - 3em = -1em.</p>
<p>当属性设置在浮动元素上,它导致该浮动定位<a href="http://www.w3.org/TR/CSS21/visuren.html#float-rules" target="_blank" rel="noopener">规则</a>的改变.一个额外的约束(#10)被添加:</p>
<ul>
<li>浮动的<a href="http://www.w3.org/TR/CSS21/box.html#outer-edge" target="_blank" rel="noopener">顶部外边</a>必须低于所有之前的left-floating盒子(就’clear:left’来说)的底部外边,或者所有right-floating盒(就’clear: right’来说), 或者 both (‘clear: both’).<br><strong>注意:</strong>这个属性<a href="http://www.w3.org/TR/REC-CSS1#clear" target="_blank" rel="noopener">适用于所有 CSS1中元素</a>. 实现可以在所有元素上支持该属性.在CSS2和CSS2.1’clear’属性仅仅应用于块级元素.因此程序设计者应该只把该属性用在块 级元素上.如果一个实现支持内联元素的clear,而不是设置一个上面解释的清除,实现应该强制一个打断和有效的插入一个或多个空的行盒(或偏移新的行盒 向下就像<a href="http://www.w3.org/TR/CSS21/visuren.html#floats" target="_blank" rel="noopener">章节9.5</a>)来移动顶部的被清除内联行盒到各自的浮动盒下面.</li>
</ul>
<h3 id="9-6-绝对定位-Absolute-positioning"><a href="#9-6-绝对定位-Absolute-positioning" class="headerlink" title="9.6 绝对定位 Absolute positioning"></a>9.6 绝对定位 Absolute positioning</h3><p>在绝对定位模型中,一个盒子基于它的包含块而显式地偏移.它完全从常规流向中脱离(对后继的同胞没有影响).一个绝对定位盒为它的常规流向子元素和绝对地 定位(不是fixed)后代生成一个新的包含块.不过,绝对定位元素的内容不会在其它盒的周围排列.它们可能会也可能不会挡住另外一个盒子的内容(或者被 挡住),这取决于互相重合的盒的<a href="http://www.w3.org/TR/CSS21/visuren.html#stack-level" target="_blank" rel="noopener">堆叠层次</a>.</p>
<p>本规范中如果引用到一个绝对定位元素(或它的盒)隐含着该元素的’position’属性设置为’absolute’或’fixed’.</p>
<h4 id="9-6-1-固定定位-Fixed-positioning"><a href="#9-6-1-固定定位-Fixed-positioning" class="headerlink" title="9.6.1 固定定位 Fixed positioning"></a>9.6.1 固定定位 Fixed positioning</h4><p>固定定位是绝对定位的一个子类。唯一的区别是，对于固定定位盒子,它的包含块由<a href="http://www.w3.org/TR/CSS21/visuren.html#viewport" target="_blank" rel="noopener">视点</a>创建.对于<a href="http://www.w3.org/TR/CSS21/media.html#continuous-media-group" target="_blank" rel="noopener">连续媒介</a>,固定盒并不随着文档的滚动而移动.从这个意义上 说,它们类似于<a href="http://www.w3.org/TR/CSS21/colors.html#background-properties" target="_blank" rel="noopener">固定的背景图形</a>.对于<a href="http://www.w3.org/TR/CSS21/page.html" target="_blank" rel="noopener">页面媒介</a>,固定定位盒在每页里重复.需要在每一页底部放置一个签名时,这个方法很有用.</p>
<p>作者可以使用固定定位来创建类似框架的呈现.考虑如下的框架布局:</p>
<p><img src="http://www.w3.org/TR/CSS21/images/frame.png" alt="Image illustrating a frame-like layout with position="> <a href="http://localhost:8080/web/images/longdesc/frame-desc.html" title="Long description for frame layout example" target="_blank" rel="noopener">[D]</a></p>
<p>可以通过如下的HTML文档和样式表来达到这一效果:</p>
<p>&lt;!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0//EN”&gt;<br>&lt;HTML&gt;<br>&lt;HEAD&gt;<br>&lt;TITLE&gt;A frame document with CSS2&lt;/TITLE&gt;<br>&lt;STYLE type=”text/css”&gt;<br>BODY { height: 8.5in } /<em> Required for percentage heights below </em>/</p>
<p>#header {<br>position: fixed;<br>width: 100%;<br>height: 15%;<br>top: 0;<br>right: 0;<br>bottom: auto;<br>left: 0;<br>}</p>
<p>#sidebar {<br>position: fixed;<br>width: 10em;<br>height: auto;<br>top: 15%;<br>right: auto;<br>bottom: 100px;<br>left: 0;<br>}</p>
<p>#main {<br>position: fixed;<br>width: auto;<br>height: auto;<br>top: 15%;<br>right: 0;<br>bottom: 100px;<br>left: 10em;<br>}</p>
<p>#footer {<br>position: fixed;<br>width: 100%;<br>height: 100px;<br>top: auto;<br>right: 0;<br>bottom: 0;<br>left: 0;<br>}<br>&lt;/STYLE&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>&lt;DIV id=”header”&gt; …  &lt;/DIV&gt;<br>&lt;DIV id=”sidebar”&gt; …  &lt;/DIV&gt;<br>&lt;DIV id=”main”&gt; …  &lt;/DIV&gt;<br>&lt;DIV id=”footer”&gt; …  &lt;/DIV&gt;<br>&lt;/BODY&gt;<br>&lt;/HTML&gt;</p>

      
    </div>
    <footer class="article-footer">
<div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a><a href="#" class="bds_linkedin" data-cmd="linkedin" title="分享到linkedin"></a><a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a></div>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/CSS/">CSS</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/w3c标准/">w3c标准</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/web/">web</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/翻译/">翻译</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2011/04/27/javascript-e5-92-8cjava-e4-b8-ad-e7-9a-84this-e5-85-b3-e9-94-ae-e5-ad-97-this-keyword-in-javascript-and-java/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          Javascript和Java中的this关键字_This keyword in Javascript and Java
        
      </div>
    </a>
  
  
    <a href="/2011/02/08/e8-8e-b7-e5-8f-96n-e4-b8-aa-e4-b8-8d-e9-87-8d-e5-a4-8d-e9-9a-8f-e6-9c-ba-e6-95-b0-e7-9a-84-e4-b8-89-e7-a7-8d-e6-96-b9-e6-b3-95-three-methods-get-n-not-repeated-random-number/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">获取n个不重复随机数的三种方法_Three methods get n+ not repeated random number</div>
    </a>
  
</nav>

  


<div class="ds-thread" data-thread-key="2011/02/20/css2-e4-b8-ad-e7-9a-84-e5-8f-af-e8-a7-86-e5-8c-96-e6-a0-bc-e5-bc-8f-e6-a8-a1-e5-9e-8b-visual-fomatting-model-in-css2/"></div>

</article></section>
        
          <aside id="sidebar">
  
    <div class="widget-wrap">
  <h3 class="widget-title">Github</h3>
  <div class="widget">
    <ul class="category-list"><li class="category-list-item"><a href="https://github.com/rainzhai">https://github.com/rainzhai</a></li></ul>
  </div>
</div>

  <div class="widget-wrap">
    <h3 class="widget-title">分类 Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/CSS/">CSS</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/CSS-amp-HTML/">CSS &amp; HTML</a><span class="category-list-count">29</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/CSS-amp-HTML/html5/">html5</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/CSS-amp-HTML/javascript-amp-Ajax/">javascript &amp; Ajax</a><span class="category-list-count">2</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/CSS-amp-HTML/javascript-amp-Ajax/移动端开发/">移动端开发</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/CSS-amp-HTML/web-development/">web development</a><span class="category-list-count">2</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/CSS-amp-HTML/web-development/移动端开发/">移动端开发</a><span class="category-list-count">1</span></li></ul></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/blog/">blog</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/computer-science/">computer science</a><span class="category-list-count">10</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/computer-science/java-web/">java web</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/computer-science/web-development/">web development</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/computer-science/算法/">算法</a><span class="category-list-count">2</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/html5/">html5</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/hybrid/">hybrid</a><span class="category-list-count">2</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/hybrid/phonegap/">phonegap</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/java-web/">java web</a><span class="category-list-count">10</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/javascript-amp-Ajax/">javascript &amp; Ajax</a><span class="category-list-count">23</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/javascript-amp-Ajax/jquery/">jquery</a><span class="category-list-count">1</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/javascript-amp-Ajax/jquery/web-development/">web development</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/javascript-amp-Ajax/web-development/">web development</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/javascript-amp-Ajax/算法/">算法</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/jquery/">jquery</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/nodejs/">nodejs</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/php/">php</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/web-development/">web development</a><span class="category-list-count">15</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/前端/">前端</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/智趣/">智趣</a><span class="category-list-count">5</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/智趣/游戏/">游戏</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/智趣/生活/">生活</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/未分类/">未分类</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/模块化/">模块化</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/游戏/">游戏</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/生活/">生活</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/资源/">资源</a><span class="category-list-count">1</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签 Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Angularjs/">Angularjs</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CSS/">CSS</a><span class="tag-list-count">21</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CSS-3/">CSS 3</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/D2/">D2</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/DIY/">DIY</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Design/">Design</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Structure/">Structure</a><span class="tag-list-count">8</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/app/">app</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/blog/">blog</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/bug/">bug</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/css3/">css3</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/debug/">debug</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dojo/">dojo</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/easy-ui/">easy ui</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/firefox/">firefox</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flash/">flash</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/free-hosting/">free hosting</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/game/">game</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/geekTime/">geekTime</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/html/">html</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/html5/">html5</a><span class="tag-list-count">18</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hybrid/">hybrid</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ie/">ie</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ios/">ios</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a><span class="tag-list-count">28</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jquery/">jquery</a><span class="tag-list-count">7</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jquery-mobile/">jquery mobile</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jsp/">jsp</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mobile/">mobile</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nodejs/">nodejs</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/npm/">npm</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/photos/">photos</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/php/">php</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/requirejs/">requirejs</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/seam/">seam</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/svg/">svg</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/threejs/">threejs</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ued/">ued</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/w3c标准/">w3c标准</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/web/">web</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/webapp/">webapp</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/webgl/">webgl</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/webpage/">webpage</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wordpress/">wordpress</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/上下文/">上下文</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/分享/">分享</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/前端/">前端</a><span class="tag-list-count">8</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/前端-Javascript-css-ES6/">前端 Javascript css ES6</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/学习/">学习</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/性能/">性能</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/总结/">总结</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/效率/">效率</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/模块化/">模块化</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/游戏/">游戏</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/理论/">理论</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/生活/">生活</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/社会化网络/">社会化网络</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/移动/">移动</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/移动端开发/">移动端开发</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/算法/">算法</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/编程/">编程</a><span class="tag-list-count">18</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/美女/">美女</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/翻译/">翻译</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/范式/">范式</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/设计模式/">设计模式</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/语义网/">语义网</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/语言/">语言</a><span class="tag-list-count">21</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/资源/">资源</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/转载/">转载</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/面向对象/">面向对象</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/风景/">风景</a><span class="tag-list-count">1</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签云 Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/Angularjs/" style="font-size: 10px;">Angularjs</a> <a href="/tags/CSS/" style="font-size: 19.09px;">CSS</a> <a href="/tags/CSS-3/" style="font-size: 13.64px;">CSS 3</a> <a href="/tags/D2/" style="font-size: 10px;">D2</a> <a href="/tags/DIY/" style="font-size: 10px;">DIY</a> <a href="/tags/Design/" style="font-size: 10.91px;">Design</a> <a href="/tags/Structure/" style="font-size: 16.36px;">Structure</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/app/" style="font-size: 10px;">app</a> <a href="/tags/blog/" style="font-size: 10.91px;">blog</a> <a href="/tags/bug/" style="font-size: 10px;">bug</a> <a href="/tags/css3/" style="font-size: 14.55px;">css3</a> <a href="/tags/debug/" style="font-size: 10px;">debug</a> <a href="/tags/dojo/" style="font-size: 10px;">dojo</a> <a href="/tags/easy-ui/" style="font-size: 10px;">easy ui</a> <a href="/tags/firefox/" style="font-size: 10px;">firefox</a> <a href="/tags/flash/" style="font-size: 10px;">flash</a> <a href="/tags/free-hosting/" style="font-size: 10px;">free hosting</a> <a href="/tags/game/" style="font-size: 10px;">game</a> <a href="/tags/geekTime/" style="font-size: 10px;">geekTime</a> <a href="/tags/html/" style="font-size: 13.64px;">html</a> <a href="/tags/html5/" style="font-size: 18.18px;">html5</a> <a href="/tags/hybrid/" style="font-size: 11.82px;">hybrid</a> <a href="/tags/ie/" style="font-size: 10.91px;">ie</a> <a href="/tags/ios/" style="font-size: 10px;">ios</a> <a href="/tags/java/" style="font-size: 17.27px;">java</a> <a href="/tags/javascript/" style="font-size: 20px;">javascript</a> <a href="/tags/jquery/" style="font-size: 15.45px;">jquery</a> <a href="/tags/jquery-mobile/" style="font-size: 10.91px;">jquery mobile</a> <a href="/tags/jsp/" style="font-size: 10px;">jsp</a> <a href="/tags/mobile/" style="font-size: 10.91px;">mobile</a> <a href="/tags/nodejs/" style="font-size: 10px;">nodejs</a> <a href="/tags/npm/" style="font-size: 10px;">npm</a> <a href="/tags/photos/" style="font-size: 10px;">photos</a> <a href="/tags/php/" style="font-size: 10px;">php</a> <a href="/tags/requirejs/" style="font-size: 10.91px;">requirejs</a> <a href="/tags/seam/" style="font-size: 10.91px;">seam</a> <a href="/tags/svg/" style="font-size: 10px;">svg</a> <a href="/tags/threejs/" style="font-size: 10px;">threejs</a> <a href="/tags/ued/" style="font-size: 10.91px;">ued</a> <a href="/tags/w3c标准/" style="font-size: 12.73px;">w3c标准</a> <a href="/tags/web/" style="font-size: 13.64px;">web</a> <a href="/tags/webapp/" style="font-size: 10.91px;">webapp</a> <a href="/tags/webgl/" style="font-size: 10px;">webgl</a> <a href="/tags/webpage/" style="font-size: 10.91px;">webpage</a> <a href="/tags/wordpress/" style="font-size: 11.82px;">wordpress</a> <a href="/tags/上下文/" style="font-size: 10px;">上下文</a> <a href="/tags/分享/" style="font-size: 10.91px;">分享</a> <a href="/tags/前端/" style="font-size: 16.36px;">前端</a> <a href="/tags/前端-Javascript-css-ES6/" style="font-size: 10px;">前端 Javascript css ES6</a> <a href="/tags/学习/" style="font-size: 10px;">学习</a> <a href="/tags/性能/" style="font-size: 12.73px;">性能</a> <a href="/tags/总结/" style="font-size: 10.91px;">总结</a> <a href="/tags/效率/" style="font-size: 11.82px;">效率</a> <a href="/tags/模块化/" style="font-size: 10.91px;">模块化</a> <a href="/tags/游戏/" style="font-size: 11.82px;">游戏</a> <a href="/tags/理论/" style="font-size: 14.55px;">理论</a> <a href="/tags/生活/" style="font-size: 10.91px;">生活</a> <a href="/tags/社会化网络/" style="font-size: 10.91px;">社会化网络</a> <a href="/tags/移动/" style="font-size: 10px;">移动</a> <a href="/tags/移动端开发/" style="font-size: 10px;">移动端开发</a> <a href="/tags/算法/" style="font-size: 13.64px;">算法</a> <a href="/tags/编程/" style="font-size: 18.18px;">编程</a> <a href="/tags/美女/" style="font-size: 10px;">美女</a> <a href="/tags/翻译/" style="font-size: 13.64px;">翻译</a> <a href="/tags/范式/" style="font-size: 12.73px;">范式</a> <a href="/tags/设计模式/" style="font-size: 11.82px;">设计模式</a> <a href="/tags/语义网/" style="font-size: 10px;">语义网</a> <a href="/tags/语言/" style="font-size: 19.09px;">语言</a> <a href="/tags/资源/" style="font-size: 10.91px;">资源</a> <a href="/tags/转载/" style="font-size: 10px;">转载</a> <a href="/tags/面向对象/" style="font-size: 10px;">面向对象</a> <a href="/tags/风景/" style="font-size: 10px;">风景</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">文章 Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/07/">July 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/06/">June 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/">August 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/10/">October 2014</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">February 2014</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/01/">January 2014</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/12/">December 2013</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/09/">September 2013</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/03/">March 2013</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/01/">January 2013</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/11/">November 2012</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/08/">August 2012</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/06/">June 2012</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/05/">May 2012</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/04/">April 2012</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/03/">March 2012</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/02/">February 2012</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/01/">January 2012</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/12/">December 2011</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/11/">November 2011</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/10/">October 2011</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/09/">September 2011</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/08/">August 2011</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/07/">July 2011</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/06/">June 2011</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/04/">April 2011</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/02/">February 2011</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/01/">January 2011</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/12/">December 2010</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/11/">November 2010</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/10/">October 2010</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/09/">September 2010</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/08/">August 2010</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/06/">June 2010</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/04/">April 2010</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/01/">January 2010</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2009/08/">August 2009</a><span class="archive-list-count">1</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最近 Recents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2018/07/23/nvm安装问题处理-nvm-is-not-compatible-with-the-npm-config-prefix-option-错误/">nvm安装问题处理 nvm is not compatible with the npm config prefix option 错误</a>
          </li>
        
          <li>
            <a href="/2018/06/06/前端知识体系大全/">前端知识体系大全</a>
          </li>
        
          <li>
            <a href="/2016/08/28/使用Angularjs开发控制台类项目/">使用Angularjs开发控制台类项目</a>
          </li>
        
          <li>
            <a href="/2016/07/11/Apicloud开发app的问题总结/">Apicloud开发app的问题总结</a>
          </li>
        
          <li>
            <a href="/2016/04/25/前端面试经典问题/">前端面试经典问题</a>
          </li>
        
      </ul>
    </div>
  </div>

  
      <div class="widget-wrap">
<h3 class="widget-title">友情链接 Links</h3>
<div class="widget">
<ul>
<li><a href="http://wande.me" title="玩的么" target="_blank">玩的么</a></li>
</ul>
</ul>
</div>
  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 宅鱼<br>
      更多游戏： <a href="http://wande.me"  target="_blank">玩的么</a><br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">首页</a>
  
    <a href="/archives" class="mobile-nav-link">文章</a>
  
    <a href="/raincss" class="mobile-nav-link">RainCSS</a>
  
</nav>
    <!-- 多说公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"rainzhai"};
  (function() {
    var ds = document.createElement('script');
    ds.type = 'text/javascript';ds.async = true;
    ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
    ds.charset = 'UTF-8';
    (document.getElementsByTagName('head')[0] 
     || document.getElementsByTagName('body')[0]).appendChild(ds);
  })();
  </script>
<!-- 多说公共JS代码 end -->

<script type="text/javascript" src="http://wandeme.com/js/jquery-1.7.2.min.js"></script>

<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F49ba6eabd43121d820d9120777bdaf30' type='text/javascript'%3E%3C/script%3E"));
</script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>